﻿@if (Model.PromotionCodeList == null || Model.PromotionCodeList.Count == 0)
{
    <div class="nothingHere">
        <i class="fa fa-leaf"></i>
        <p>~优惠券空空如也~</p>
        <a href="~/" class="rjbtn rjbtnGreen">去逛逛</a>
    </div>
}
else
{
    foreach (var promotionCode in Model.PromotionCodeList)
    {
        <div class="promotionCodeItem">
            <div class="promotionCodeBody">
                <span class="bianhao">No. @promotionCode.PromotionCode
                </span>
                <span class="mianzhi">￥@promotionCode.Discount.ToString("F0")<em>元</em></span>

                 @if (@promotionCode.PromotionType == 0)
            {
                <span class="tiaojian">订单满 ￥@promotionCode.Amount.ToString("F0") 可使用 </span>
            }
            else if (@promotionCode.PromotionType == 1)
            {
                <span class="tiaojian">@Html.Raw("没有消费金额限制")</span>
            }
                


               
                <span class="type">
                    @if (@promotionCode.PromotionType == 0)
                    {
                        @Html.Raw("优惠券")
                    }
                    else
                    {
                        @Html.Raw("代金券")
                    }
                </span>
            </div>
            <div class="promotionCodeDate">
                <p><strong>券名称：</strong>@promotionCode.CouponName</p>
                <p><strong>领取时间：</strong>@promotionCode.ReceiveDate</p>
                @if (Model.Status == 1)
                {
                    <p><strong>使用时间：</strong>@promotionCode.UseDate</p>
                    <p><strong>使用订单号：</strong>@promotionCode.OrderNumber</p>
                }
                <p><strong>有 效 期：</strong>@promotionCode.StartDate  @Html.Raw("至")  @promotionCode.EndTime</p>
                <h6><strong>适用范围</strong></h6>
                @if (promotionCode.PromotionCodeItemList != null && promotionCode.PromotionCodeItemList.Count > 0)
                {
                    foreach (var item in promotionCode.PromotionCodeItemList)
                    {
                    <ul class="ProductsList">
                        @if (!string.IsNullOrEmpty(@item.ProductId) && @item.UsableType == 1)
                        {
                            <li>
                                @Html.Raw("【商品限制】")<a href="~/Product/ProductDetail?prd=@item.ProductId" target="_blank">@item.ProductName</a>
                            </li>
                        }
                        else if ((@item.ManufactoryId != null && @item.ManufactoryId != 0) && (@item.CategoryId != null && @item.CategoryId != 0) && @item.UsableType == 2)
                        {
                            <li>
                                @Html.Raw("【品牌+类别限制】")@item.ManufactoryName@Html.Raw("品牌-")
                                <a href="~/Product/ProductList?sid=@item.CategoryId" target="_blank">@item.CategoryName@Html.Raw("类")</a>
                            </li>
                        }
                        else if ((@item.CategoryId != null && @item.CategoryId != 0) && (@item.ManufactoryId == null || @item.ManufactoryId == 0) && @item.UsableType == 4)
                        {
                            <li>
                                @Html.Raw("【类别限制】")<a href="~/Product/ProductList?sid=@item.CategoryId" target="_blank">@item.CategoryName@Html.Raw("类")</a>
                            </li>
                        }
                        else if ((@item.ManufactoryId != null && @item.ManufactoryId != 0) && (@item.CategoryId == null || @item.CategoryId == 0) && @item.UsableType == 3)
                        {
                            <li>
                                @Html.Raw("【品牌限制】")@item.ManufactoryName
                            </li>
                        }
                    </ul>
                    }
                }
                else
                {
                    @Html.Raw("全站通用")
                }
            </div>
            <br class="clearfix">
        </div>
    }
}
